package com.cloud.api.myenum;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

public enum AlarmTypeEnum implements IEnum<Integer> {

    TEMPERATURE_DIFFERENCE(1,"温度差异报警"),
    BATTERY_OVERHEAT(2,"电池高温报警"),
    VEHICLE_STORAGE_DEVICE_TYPE_OVERVOLTAGE(3,"车载储能装置类型过压报警"),
    VEHICLE_STORAGE_DEVICE_TYPE_UNDERVOLTAGE(4,"车载储能装置类型欠压报警"),
    SOC_LOW(5,"SOC过低报警"),
    SINGLE_CELL_BATTERY_OVERVOLTAGE(6,"单体电池过压报警"),
    SINGLE_CELL_BATTERY_UNDERVOLTAGE(7,"单体电池欠压报警"),
    SOC_HIGH(8,"SOC过高报警"),
    SOC_JUMP(9,"SOC跳变报警"),
    CHARGEABLE_STORAGE_SYSTEM_MISMATCH(10,"可充电储能系统不匹配报警"),
    SINGLE_CELL_BATTERY_CONSISTENCY_DIFFERENCE(11,"单体电池一致性差报警"),
    INSULATION_ALARM(12,"绝缘报警"),
    DC_TEMPERATURE_ALARM(13,"DC温度报警"),
    BRAKE_SYSTEM_ALARM(14,"制动系统报警"),
    DC_STATUS_ALARM(15,"DC状态报警"),
    DRIVE_MOTOR_CONTROLLER_TEMPERATURE_ALARM(16,"驱动电机控制器温度报警"),
    HIGH_VOLTAGE_INTERLOCK_ALARM(17,"高压互锁报警"),
    DRIVE_MOTOR_TEMPERATURE_ALARM(18,"驱动电机温度报警"),
    VEHICLE_STORAGE_DEVICE_OVERCHARGE_ALARM(19,"车载储能装置过充报警");

    AlarmTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static AlarmTypeEnum getByValue(Integer value) {
        for (AlarmTypeEnum alarmTypeEnum : AlarmTypeEnum.values()) {
            if (alarmTypeEnum.getValue().equals(value)) {
                return alarmTypeEnum;
            }
        }

        return null;
    }

    public static String getDesc(Integer value) {
        for (AlarmTypeEnum alarmTypeEnum : AlarmTypeEnum.values()) {
            if (alarmTypeEnum.getValue().equals(value)) {
                return alarmTypeEnum.getDesc();
            }
        }
        return null;
    }

    private Integer value;
    @Getter
    @EnumValue
    @JsonValue
    private String desc;

    @Override
    public Integer getValue() {
        return this.value;
    }
}
